﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="net.sycu.guomy.ems.entity.*"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<%@ taglib prefix="ckeditor" uri="http://ckeditor.com" %>
<%//标记库指令  %>


<!DOCTYPE HTML>
<html>
<head>
<title>发送个人消息</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords"
	content="Novus Admin Panel Responsive web template, Bootstrap Web Templates, Flat Web Templates, Android Compatible web template, 
SmartPhone Compatible web template, free WebDesigns for Nokia, Samsung, LG, SonyEricsson, Motorola web design" />
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<!-- Bootstrap Core CSS -->
<link href="/EMS/css/bootstrap.css" rel='stylesheet' type='text/css' />
<!-- Custom CSS -->
<link href="/EMS/css/style.css" rel='stylesheet' type='text/css' />
<!-- font CSS -->
<!-- font-awesome icons -->
<link href="/EMS/css/font-awesome.css" rel="stylesheet">
<!-- //font-awesome icons -->
<!-- js-->
<script src="/EMS/js/jquery-1.11.1.min.js"></script>
<script src="/EMS/js/modernizr.custom.js"></script>
<!--webfonts-->
<link href='/EMS/css/123.css' rel='stylesheet' type='text/css'>
<!--//webfonts-->
<!--animate-->
<link href="/EMS/css/animate.css" rel="stylesheet" type="text/css"
	media="all">
<script src="/EMS/js/wow.min.js"></script>
<script>
		 new WOW().init();
	</script>
<!--//end-animate-->
<!-- chart -->
<script src="/EMS/js/Chart.js"></script>
<!-- //chart -->
<!--Calender-->
<link rel="stylesheet" href="/EMS/css/clndr.css" type="text/css" />
<script src="/EMS/js/underscore-min.js" type="text/javascript"></script>
<script src="/EMS/js/moment-2.2.1.js" type="text/javascript"></script>
<script src="/EMS/js/clndr.js" type="text/javascript"></script>
<script src="/EMS/js/site.js" type="text/javascript"></script>
<!--End Calender-->


<!-- Metis Menu -->
<script src="/EMS/js/metisMenu.min.js"></script>
<script src="/EMS/js/custom.js"></script>
<link href="/EMS/css/custom.css" rel="stylesheet">
<!--//Metis Menu -->
</head>
<body onload="myLoad()" class="cbp-spmenu-push">

	<%@include file="/header.jsp"%>


	<!-- Main content starts -->

	<%@include file="/user/userSidebar.jsp"%>

	<div id="page-wrapper">
		<div class="main-page">
			<div class="tables">
				<h3 class="title1">部门信息管理</h3>
<form class="form-horizontal" role="form" id="frmNote"
			  action="/EMS/user/SendNoteListServlet" method="post" >
			 <input type="hidden" id="hidOperateType" name="hidOperateType" value="" />
	          <input type="hidden" id="hidNoteId" name="hidNoteId" 
	            value="${requestScope.ModifyNote.noteId}" />
                
                	
                	
                    <div class="table-responsive bs-example widget-shadow">
					<h4 class="title1">输入个人消息</h4>
					<a href="#" class="wminimize"><i class="icon-chevron-down"></i></a> 
                    <a href="#" class="wclose"><i class="icon-remove"></i></a>
			<div class="main-page general">
				<div class="panel-info widget-shadow">
					<div class="col-md-12 panel-grids">
						<div class="panel panel-primary"> <div class="panel-heading"> <h3 class="panel-title">标题</h3> </div> <div class="panel-body"> 
						 <input type="text" class="form-control" id="txtTitle" name="txtTitle" 
                          placeholder="标题" value="${ModifyNote.title}">
                        <span class="label label-danger" id="spanTitle"></span></div> </div>
					</div>
					<div class="col-md-12 panel-grids">
						<div class="panel panel-info"> <div class="panel-heading"> <h3 class="panel-title">接收人</h3> </div> <div class="panel-body">
						 <select class="form-control" id="selDepartmentId" name="selDepartmentId" onchange="selectDepartment()">
                          <option value="0">-请选择部门-</option>
                          <c:forEach items="${departments}" var="department">
                          <c:if test="${empty requestScope.ModifyNote}">
                            <option value="${department.departmentId}" 
                              <c:if test="${ department.departmentId == selDepartmentId}">selected="selected"</c:if>>
                            ${department.departmentName}</option>
                          </c:if>
                          <c:if test="${not empty requestScope.ModifyNote}">
                            <option value="${department.departmentId}" 
                              <c:if test="${ department.departmentId == ModifyNote.sendeeId}">selected="selected"</c:if>>
                            ${department.departmentName}</option>
                          </c:if>
                          </c:forEach>
                        </select>
                        <select class="form-control" id="selSendeeId" name="selSendeeId">
                          <option value="0">-请选择-</option>
                          <c:forEach items="${sendees}" var="sendee">
                          <option value="${sendee.loginId}" 
                            <c:if test="${sendee.loginId == ModifyNote.sendeeId}">selected="selected"</c:if>>
                          ${sendee.loginName}</option>
                          </c:forEach>
                        </select>
                        </div> </div>
					</div>
					<div class="col-md-12 panel-grids">
						<div class="panel panel-danger"> <div class="panel-heading"> <h3 class="panel-title">内容</h3> </div> <div class="panel-body">
						<textarea class="form-control" rows="3" id="txtContent" name="txtContent" 
                          placeholder="内容">${ModifyNote.content}</textarea>
                        <ckeditor:replace replace="txtContent" basePath="/EMS/ckeditor/" /> </div> </div>
					</div>
					<div class="clearfix"> </div>
				</div>
					<div data-example-id="form-validation-states" >
						
							<div class="form-group">
                      <div class="col-lg-offset-1 col-lg-5">
	                      <c:if test="${empty requestScope.ModifyMessage }">
                         <button class="btn btn-primary" type="reset" onclick="addMessage()">发布</button>
                         <button type="reset" class="btn btn-default">取消</button>
                        </c:if>
                        <c:if test="${not empty requestScope.ModifyMessage }">
                         <button class="btn btn-primary" type="reset" onclick="saveMessage()">保存</button>
                         <button class="btn btn-default" type="reset" onclick="cancelSaveMessage()">取消保存</button>
                        </c:if>
                      </div>
                    </div>
					</div>
				</div>
				</div>
				<div class="table-responsive bs-example widget-shadow">
				<h4 class="title1">部门信息查询</h4>
					<a href="#" class="wminimize"><i class="icon-chevron-down"></i></a> 
                    <a href="#" class="wclose"><i class="icon-remove"></i></a>
			<div class="main-page general">
				<div class="panel-info widget-shadow">
					<div class="col-md-12 panel-grids">
						<div class="panel panel-primary"> <div class="panel-heading"> <h3 class="panel-title">部门名称</h3> </div> <div class="panel-body"> <input type="text" class="form-control" id="txtDepartmentName"
									name="txtDepartmentName" placeholder="部门名称"
									value="${requestScope.ModifyDepartment.departmentName }">
								<span class="help-block" id="spanDepartmentName"></span> </div> </div>
					</div>
					<div class="col-md-12 panel-grids">
						<div class="panel panel-info"> <div class="panel-heading"> <h3 class="panel-title"> 部门地址</h3> </div> <div class="panel-body"> <input type="text" class="form-control" id="txtAddress" name="txtAddress" 
                        placeholder="部门地址" value="${requestScope.ModifyDepartment.address }"></div> </div>
					</div>
					<div class="col-md-12 panel-grids">
						<div class="panel panel-danger"> <div class="panel-heading"> <h3 class="panel-title">部门描述</h3> </div> <div class="panel-body"><textarea class="form-control" rows="3" id="txtDescription" name="txtDescription"
                         placeholder="部门描述">${requestScope.ModifyDepartment.description }</textarea> </div> </div>
					</div>
							<div class="form-group">
                      <div class="col-lg-offset-1 col-lg-9">
	                      <div class="col-lg-offset-1 col-lg-9">        
	                        <button class="btn btn-primary" type="reset" onclick="searchDepartment()">查询</button>                             
	                        <button class="btn btn-default" type="reset" onclick="cancelSearchDepartment()">取消查询</button>              
                      </div>
                      </div>
                    </div>
					</div>
				</div>
				</div>
						</form>

				
					<div class="widget-foot">
						
				</div>
			</div>
		</div>
	</div>


	<%@include file="/footer.jsp"%>


	<!-- Scroll to top -->
	<span class="totop"><a href="#"><i class="icon-chevron-up"></i>
	</a>
	</span>

	<!--scrolling js-->
	<script src="/EMS/js/jquery.nicescroll.js"></script>
	<script src="/EMS/js/scripts.js"></script>
	<!--//scrolling js-->
	<!-- Bootstrap Core JavaScript -->
	<script src="/EMS/js/bootstrap.js"> </script>
	<script src="/EMS/js/classie.js"></script>

	<!-- Script for this page -->
	<script type="text/javascript">
var menuLeft = document.getElementById( 'cbp-spmenu-s1' ),
				showLeftPush = document.getElementById( 'showLeftPush' ),
				body = document.body;
				
			showLeftPush.onclick = function() {
				classie.toggle( this, 'active' );
				classie.toggle( body, 'cbp-spmenu-push-toright' );
				classie.toggle( menuLeft, 'cbp-spmenu-open' );
				disableOther( 'showLeftPush' );
			};
			
			function disableOther( button ) {
				if( button !== 'showLeftPush' ) {
					classie.toggle( showLeftPush, 'disabled' );
				}
			}

//验证
function checkInput(){
	var txtDepartmentName = document.getElementById("txtDepartmentName");
	var spanDepartmentName = document.getElementById("spanDepartmentName");
	
	if(txtDepartmentName.value.length == 0){
		spanDepartmentName.innerHTML = "部门名不能为空。";
	    return false;
	}
	else{
		spanDepartmentName.innerHTML="";
		return true;
	}
}
function checkSearch(){
	var txtSearchDepartmentName = document.getElementById("txtSearchDepartmentName");
	var txtSearchAddress = document.getElementById("txtSearchAddress");
	var txtSearchDescription = document.getElementById("txtSearchDescription");
	var spanSearch = document.getElementById("spanSearch");
	
	if(txtSearchDepartmentName.value.length == 0
	&& txtSearchAddress.value.length == 0
	&& txtSearchDescription.value.length == 0){
		spanSearch.innerHTML = "查询条件不能为空。";
		return false;
	}
	else{
		spanSearch.innerHTML="";
		return true;
	}
}
function addDepartment(){
	if (checkInput()){
	  var frmDepartment = document.getElementById("frmDepartment");
	  var hidOperateType = document.getElementById("hidOperateType");//获取表单
	  
	  hidOperateType.value="add";
	  frmDepartment.submit();
	  
	}
}

function removeDepartment(departmentId){
	if(confirm("确定要删除么？")){
		var frmDepartment = document.getElementById("frmDepartment");
		var hidOperateType = document.getElementById("hidOperateType");
		var hidDepartmentId = document.getElementById("hidDepartmentId");

		hidDepartmentId.value = departmentId;
		hidOperateType.value="remove";
		frmDepartment.submit();
		//alert(departmentId);
	}
}

function modifyDepartment(departmentId){
	var frmDepartment = document.getElementById("frmDepartment");
	var hidOperateType = document.getElementById("hidOperateType");
	var hidDepartmentId = document.getElementById("hidDepartmentId");

	hidDepartmentId.value = departmentId;
	hidOperateType.value="modify";
	frmDepartment.submit();
	//alert(departmentId);
}

function saveDepartment(departmentId){
	if (checkInput()){
		  var frmDepartment = document.getElementById("frmDepartment");
		  var hidOperateType = document.getElementById("hidOperateType");
		  
		  hidOperateType.value="save";
		  frmDepartment.submit();
	}
}

function cancelSaveDepartment(departmentId){
	  var frmDepartment = document.getElementById("frmDepartment");
	  var hidOperateType = document.getElementById("hidOperateType");
	  
	  hidOperateType.value="cancelSave";
	  frmDepartment.submit();
}

function paging(pageIndex){
      var frmDepartment = document.getElementById("frmDepartment");
	  var hidOperateType = document.getElementById("hidOperateType");
	  var hidCurrentPageIndex = document.getElementById("hidCurrentPageIndex");
	  
	  
	  hidCurrentPageIndex.value=pageIndex;
	  hidOperateType.value = "paging";
	  frmDepartment.submit();
}

function sorting(sortField) {
    var frmDepartment = document.getElementById("frmDepartment");//通过Id获得对应的元素
	var hidOperateType = document.getElementById("hidOperateType");//通过Id获得对应的元素
	var hidSortField = document.getElementById("hidSortField");//通过Id获得对应的元素
	
	hidSortField.value = sortField;
	hidOperateType.value = "sorting";
	frmDepartment.submit();

}

function resize(pageSize){
      var frmDepartment = document.getElementById("frmDepartment");
	  var hidOperateType = document.getElementById("hidOperateType");
	  var hidPageSize = document.getElementById("hidPageSize");
	  
	  
	  hidPageSize.value = pageSize;
	  hidOperateType.value = "resize";
	  frmDepartment.submit();
//	  alart(pageSize)
}

function searchDepartment(){
      if(checkSearch()){
        var frmDepartment = document.getElementById("frmDepartment");
	    var hidOperateType = document.getElementById("hidOperateType");
	    
	    hidOperateType.value = "search";
	    frmDepartment.submit();
	  }
}
//
function cancelSearchDepartment(){
      var frmDepartment = document.getElementById("frmDepartment");
	  var hidOperateType = document.getElementById("hidOperateType");
	  var txtSearchDepartmentName = document.getElementById("txtSearchDepartmentName");
	  var txtSearchAddress = document.getElementById("txtSearchAddress");
	  var txtSearchDescription = document.getElementById("txtSearchDescription");
	  
	  txtSearchDepartmentName.value = "";
	  txtSearchAddress.value = "";
	  txtSearchDescription.value = "";
	  hidOperateType.value = "cancelSearch";
	  frmDepartment.submit();
}

function myLoad(){
 ${alertMessage}
}
/* Curve chart ends */
</script>

</body>
</html>
